package ahut2020.exp12;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Vector;

public class TestLuckyMoney {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(genLuckyMoney(15, 5)));
    }

    private static int[] genLuckyMoney(int total, int num) {
        int[] arr = new int[num];

        List<Integer> X = new Vector<Integer>();
        for (int i = 1; i <= total; i++) {
            X.add(i);
        }
        Collections.shuffle(X);
        X = X.subList(0, num);
        Collections.sort(X);
        System.out.println(X);
        arr[0] = X.get(0);
        for (int i = 1; i < arr.length; i++) {
            arr[i] = X.get(i) - X.get(i - 1);

        }
        return arr;
    }
}
